<meta charset="UTF-8">

<h1>小工具效果预览</h1>
<script src="./utils.js"></script>

<!-- 作业1：封装一个方法，只要调用就会返回 年月日时分秒 -->
<h2>1.快速获取当前时间</h2>
<script>
    console.log(format('y'));
    console.log(format('m'));
    console.log(format('r'));
    console.log(format('h'));
    console.log(format('i'));
    console.log(format('s'));
    console.log(format('week'));
    console.log(format('y/m/r'));
    console.log(format('ymrhis'));
    console.log(format('y年m月r日 h:i:s week'));
    console.log(format('y/m/r h:i:s week'));
    console.log(format('y-m-r h:i:s week'));
    console.log('--------');
</script>



<!-- 作业2：调用 dateFormat('2021-10-5 12:00:00') 返回输出刚刚、几秒前、几小时等 -->
<h2>2.日期格式化</h2>
<script>
var time = '2020-3-3 5:18:19'
console.log(dateFormat(time));
console.log('--------');
</script>



<!-- 作业3：获取随机十六进制颜色 -->
<h2>3.获取随机十六进制颜色</h2>
<h3 id="RC"></h3>
<script>
setInterval(function (){
    document.querySelector('#RC').innerText = randomColor()
    document.querySelector('#RC').style.color = randomColor()
},1000)
</script>



<!-- 作业4：判断用户浏览器 -->
<h2>4.判断用户浏览器</h2>
<script>
    // alert(getBrowserEngine())
    console.log(getBrowserEngine());
    console.log('--------');
</script>



<!-- 作业5：判断是PC端还是移动端 -->
<h2>5.判断是PC端还是移动端</h2>
<script>
    // alert(isPcOrMobile())
    console.log(isPcOrMobile());
    console.log('--------');
</script>



<!-- 作业6：判断是否是微信浏览器 -->
<h2>6.判断是否是微信浏览器</h2>
<script>
    // alert(getWechatBrowser())
    console.log(getWechatBrowser());
    console.log('--------');
</script>



<!-- 作业7：获取非行内样式（兼容IE低版本浏览器） -->
<h2>7.获取非行内样式（兼容ie低版本浏览器）</h2>
<style>
    #title{
        background: black;
    }
</style>
    <h3 id="title" style="color: green;"></h3>
<script>
    var h3Obj = document.querySelector('#title')
    console.log(getStyle(h3Obj,'color'));
    console.log('--------');
</script>